package com.lbn.jfqsc.app.message.performance.detail;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.lbn.baseframe.base.BaseActivity;
import com.lbn.baseframe.image.LoaderImage;
import com.lbn.baseframe.ui.NAppbar;
import com.lbn.baseframe.utils.DateUtils;
import com.lbn.jfqsc.R;
import com.lbn.jfqsc.business.bean.ActivityList;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

public class DetailActivity extends BaseActivity<IDetailPresenter> implements IDetailView {

    @BindView(R.id.user_photo)
    CircleImageView userPhoto;
    @BindView(R.id.user_name)
    TextView userName;
    @BindView(R.id.push_time)
    TextView pushTime;
    @BindView(R.id.start_time)
    TextView startTime;
    @BindView(R.id.content_image)
    ImageView contentImage;
    @BindView(R.id.content_text)
    TextView contentText;
    private ActivityList data;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail4);
        ButterKnife.bind(this);
        setAppbar(new NAppbar(this));
        appbar.openBack();
        appbar.setTitle("详情");
        data = (ActivityList) getIntent().getSerializableExtra("data");
    }

    @Override
    public void onPresenterCreated() {
        super.onPresenterCreated();
        LoaderImage.displayImage(data.getCommunityLogo(),userPhoto);
        userName.setText(data.getCommunityName());
        pushTime.setText("发布时间 : "+ DateUtils.stampToDate(data.getPublishDate()));
        startTime.setText("活动时间 : "+DateUtils.stampToDate(data.getActTime()));
        LoaderImage.displayImage(data.getActImg(),contentImage);
        contentText.setText(data.getActContent());

    }

    public static void startActivity(Context context, ActivityList activity) {
        Intent intent = new Intent(context, DetailActivity.class);
        intent.putExtra("data", activity);
        context.startActivity(intent);
    }

    @Override
    public IDetailPresenter createPresenter() {
        return new IDetailPresenter();
    }
}
